package com.xgst.bmg.sse.task;

import com.xgst.bmg.sse.session.SSESession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Date;

/**
 * @BelongsProject: screen-win
 * @BelongsPackage: com.xgst.bmg.sse
 * @Author: xgstjs-11
 * @CreateTime: 2021-05-26
 * @Description: SSE重连指令任务
 */
public class ReconnectTask implements Runnable {
    private static final Logger logger = LoggerFactory.getLogger(com.xgst.bmg.sse.task.ReconnectTask.class);

    private final String clientId;

    public ReconnectTask(String clientId) {
        this.clientId = clientId;
    }

    @Override
    public void run() {
        logger.info("MSG: SseReconnect | ID: {} | Date: {}", clientId, new Date());
        SSESession.send(clientId,"{\"returnType\":\"reconnect\"}");
    }
}
